<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" type="text/css" th:href="@{/css/departmentCss/base.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/css/departmentCss/layout.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/css/departmentCss/zebra_dialog.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/css/appointmentCss/secondary.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/css/normalize.css}">
    <script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css" rel="stylesheet">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js"></script>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
    <style type="text/css">
        .table3 td{
            height: 80px;
        }
        .table3 td .td_btn{
            width: 74px;
            height: 65px;
        }

    </style>
</head>
<body>
<div class="header">
    <div class="wrapper clearfix">
        <div class="logo">
            <a id="headBaseConfigWebTitle" href="javascript:void (0)" style="cursor: text;">青山门诊预约挂号</a>
        </div>
    </div>
</div>
<div class="topNav">
    <div class="wrapper">
        <div class="topNav_menu">
            <ul class="clearfix">
                <li>
                    <a id="futureReservation" th:href="@{/department}" style="cursor: text;">首页</a>
                </li>
                <li class="last">
                    <a href="appointment.html">我的中心</a>
                </li>
            </ul>
        </div>
    </div>
</div>

<div class="main appointment_main">
    <div class="wrapper clearfix">
        <p class="mt30 clearfix">

            <input type="hidden" id="timeType" value="2">
            <span class="fl">
                <a th:href="@{/department}">首页</a>
					&gt; <a href="javascript:window.history.go(-1);"> 血液病科 </a>&gt;
					<a href="javascript:void (0);" style="cursor: text;text-decoration: none;" >童向民</a>
				</span>
        </p>
        <div class="search_list clearfix">
            <div class="physician_info">
                <img class="physician_img" style="width:150px;height:200px" th:src="@{/img/doctor_imgs/srmPhoto0336.jpg}">
                <ul class="physician_list" >
                    <li>医院：<span>浙江省人民医院朝晖院区</span></li>
                    <li>科室：<span th:text="${hashMap.user.out_patient_id==1?'内科':(hashMap.user.out_patient_id==2? '外科':(hashMap.user.out_patient_id==3?'儿科':'妇产科'))}">血液病科</span></li>
                    <li>医生：<span th:text="${hashMap.user.name}">
								童向民
						</span></li>
                    <li>职称：<span th:text="${hashMap.user.level==1?'住院医师':(hashMap.user.level==2? '主治医师':(hashMap.user.level==3?'副主任医师':'主任医师'))}"></span></li>
                    <li class="row" th:text="${hashMap.user.introduce}">擅长：<span></span></li>
                </ul>
            </div>
        </div>

        <div class="main appointment_main">
            <div class="baseRight">

                <div class="dSourse">
                    <p>选择号源信息</p>
                    <ul>
                        <li style="text-align: center;font-size: large;font-weight: bold" name="scheduid" th:text="${schedu.workday}" th:id="${schedu.id}" onclick="scheduid(this)" th:each="schedu:${hashMap.SchedulingS}"></li>
                    </ul>
                    <div class="clear"></div>
                </div>
                <div class="dForm">
                    <form id="PostOrderForm" method="post" action="https://hnsrmyy.net/DoPostBack/DoOrder"
                          onsubmit="return false;"><input name="tbHashReg" type="hidden" id="tbHashReg"
                                                          value="cKGBYGzY4ooAjl2KSXrxOxMuSd+OOu916">
                        <input name="tbTokenOrder"type="hidden"id="tbTokenOrder"value="5F5DFCCE07AC9C63483E536C866077E9">
                        <inputtype="hidden" name="tbNumber" id="tbNumber" value="4" datatype="n1-2" nullmsg="请重新选择号源！"errormsg="请重新选择号源！">
                        <div class="DIVCode">
                            <div class="Validform_checktip"></div>
                        </div>

                        <div class="btn">
                            <button style="background-color: #6bcbca" id="showModel"type="button" class="btn btn-info"><i class="fa fa-refresh"></i>提交</button>
                        </div>
                        <span class="Validform_checktip"></span></form>
                </div>

                <div class="clear"></div>

            </div>
        </div>
        <script type="text/javascript">
            $(document).ready(function () {
                if ("1" == 0)
                    alert("该医生暂无排班");
            })

        </script>
        <script th:inline="javascript">

            function scheduid(obj) {
                var id = $(obj).attr('id')
                $(obj).siblings('li').removeClass('current');
                $(obj).addClass('current');
            }

            function AddAppointment(){
                var form=document.getElementById("AddAtt")
                form.submit();
            }

            $("#showModel").click(function () {
                var data = document.getElementsByClassName("current")[0];
                if(undefined===data){
                    swal({
                        title: '提示',
                        text: '请选择一天进行预约!',
                        type: "error",
                        timer:2000,
                    });
                }else{
                    var schedulingId=data.id;
                    $("#id").val(data.id);
                    $.ajax({
                        cache:true,
                        type: "get",
                        url:"http://localhost:8080/getRemainNumber",
                        data:{"schedulingId":schedulingId},
                        success:function (data) {
                            $("#remain_number_am").text(data.remain_number_am);
                            $("#remain_number_pm").text(data.remain_number_pm);
                        }
                    })
                    queueEdit(data);
                }
            });

            function queueEdit(obj) {
                var url = "#";
                $("#myModal").modal('show');
            };

        </script>
    </div>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content" style="width: 400px;">
            <div class="modal-header">
                <h4 class="modal-title" id="myModalLabel">选择时间段</h4>
                <form class="form_modal" id="AddAtt" method="post" th:action="@{/generateAppointment}">
                    <input type="hidden" id="id" name="id" value="">
                    <input type="hidden" id="workday" name="workday" value="">
                    <input type="hidden" id="doctor_id" name="doctor_id" th:value="${hashMap.user.doctor_id}">
                    <div>
                        上午余量:<li id="remain_number_am"></li><br>
                        下午余量:<li id="remain_number_pm"></li>
                    </div>
                    <p>请选择时间段</p>
                    <div class="form-group">
                        <select id="selectTime" name="selectTime" style="width: 100px">
                            <option value="0">上午</option>
                            <option value="1">下午</option>
                        </select>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal" style="width: 80px">关闭</button>
                <button id="submit" type="submit" class="btn btn-primary" onclick="AddAppointment()" style="width: 80px">确认</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
</body>
</html>